package com.jht.bletool2java.bean;

import com.jht.bletool2java.enums.TimeUnit;

public class Time {
    private long time;
    private TimeUnit unit;

    public Time(TimeUnit unit, long time) {
        this.time = time;
        this.unit = unit;
    }
    /**
     * 获取毫秒时间
     */
    public long getTime(){
        long timeTemp = 0;
        switch (unit){
            case MILLISECOND:
                timeTemp = this.time;
                break;
            case SECOND:
                timeTemp = this.time * 1000;
                break;
            case MINUTE:
                timeTemp = this.time * 60 * 1000;
                break;
            case HOUR:
                timeTemp = this.time * 60 * 60 *1000;
                break;
        }
        return timeTemp;
    }

}
